package com.demo.day0308;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 部门2
 */
@WebServlet(name = "Demo02Servlet", urlPatterns = "/demo02.do")
public class Demo02Servlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("POST");

    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("GET");
        //获取请求参数（办事材料） 查看
        String username = request.getParameter("username");
        System.out.println(username);
        System.out.println("在Servlet2(柜台2) 中查看参数");
        //查看柜台1 是否盖章（获取前面转发过来的值）
        System.out.println("柜台1是否有章：" + request.getAttribute("key1"));
        //处理自己的业务
        System.out.println("servlet2处理自己的业务");
    }
}
